//
//  ANScoreViewController.m
//  MemberProject
//
//  Created by macbook on 15/4/14.
//  Copyright (c) 2015年 MAC OS X. All rights reserved.
//

#import "ANScoreViewController.h"
#import "ANScoreTableViewCell.h"
@interface ANScoreViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic)UITableView *tableView;
@property(strong,nonatomic)NSArray *data;
@end

@implementation ANScoreViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets=NO;

    self.title=@"我的积分";
    UIView *headView=[[UIView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, (SCREEN_HEIGHT-64-49)/4)];
    [self.view addSubview:headView];
    
    UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, headView.height/4)];
    titleLabel.textAlignment=NSTextAlignmentCenter;
    [headView addSubview:titleLabel];
    titleLabel.text=@"0积分";
    
    UIButton *centerButton=[UIButton buttonWithType:UIButtonTypeCustom];
    centerButton.frame=CGRectMake(5, titleLabel.height, headView.width-10, headView.height/2);
//    UIView *centerView=[[UIView alloc]initWithFrame:CGRectMake(5, titleLabel.height, headView.width-10, headView.height/2)];
    centerButton.backgroundColor=[UIColor colorWithRed:209/255.0 green:209/255.0 blue:209/255.0 alpha:1];
    [headView addSubview:centerButton];
    [centerButton addTarget:self action:@selector(chickScoreShop:) forControlEvents:UIControlEventTouchUpInside];
    centerButton.layer.cornerRadius=5.0f;
    
    UILabel *buttonLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, centerButton.width, centerButton.height/2)];
    buttonLabel1.text=@"更多商品等着你哦,兑换根本停不下来!";
    buttonLabel1.textAlignment=NSTextAlignmentCenter;
    [centerButton addSubview:buttonLabel1];
    if(iPhone6||iPhone6Plus){
        buttonLabel1.font=[UIFont systemFontOfSize:12.0f];
    }else{
        buttonLabel1.font=[UIFont systemFontOfSize:10.0f];
    }
    
    UILabel *buttonLabel2=[[UILabel alloc]initWithFrame:CGRectMake(0, centerButton.height/2, centerButton.width, centerButton.height/2)];
    buttonLabel2.text=@"去积分商品看看 >";
    buttonLabel2.textAlignment=NSTextAlignmentCenter;
    [centerButton addSubview:buttonLabel2];
    if(iPhone6||iPhone6Plus){
        buttonLabel2.font=[UIFont systemFontOfSize:17.0f];
    }else{
        buttonLabel2.font=[UIFont systemFontOfSize:15.0f];
    }
    
    
    UILabel *miniLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, centerButton.height+centerButton.y, SCREEN_WIDTH, headView.height/4)];
    miniLabel.textAlignment=NSTextAlignmentCenter;
    [headView addSubview:miniLabel];
    miniLabel.text=@"注:积分会在获取或使用后次日进行结算";
    [headView addSubview:miniLabel];
    if(iPhone6||iPhone6Plus){
        miniLabel.font=[UIFont systemFontOfSize:12.0f];
    }else{
        miniLabel.font=[UIFont systemFontOfSize:10.0f];
    }
    
    
    
    UITableView *tableView=[[UITableView alloc]initWithFrame:CGRectMake(5, 64+(SCREEN_HEIGHT-49-64)/4, SCREEN_WIDTH-10, (SCREEN_HEIGHT-64-49)/4*3-10) style:UITableViewStylePlain];
    tableView.delegate=self;
    tableView.dataSource=self;
    [self.view addSubview:tableView];
    tableView.layer.borderColor=[UIColor colorWithRed:225/255.0 green:225/255.0 blue:225/255.0 alpha:1].CGColor;
    tableView.layer.borderWidth=0.5f;
    tableView.layer.cornerRadius=5.0f;
    self.tableView=tableView;
    [self.tableView registerNib:[UINib nibWithNibName:@"ANScoreTableViewCell" bundle:nil] forCellReuseIdentifier:@"CellIdentifier"];
    
}

#pragma mark - tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier=@"CellIdentifier";
    ANScoreTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    return cell;
}

#pragma mark - button
-(void)chickScoreShop:(UIButton *)sender{
    //积分商场
}
@end
